package com.yixun.qfbao.hander;

import com.yixun.qfbao.model.enums.SystemIdEnum;
import com.yixun.qfbao.util.WxAccessTokenCacheUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yixun.qfbao.api.service.PremisesApiService;
import com.yixun.qfbao.apidto.AssignPremisesAgentReqDto;
import com.yixun.qfbao.apidto.AssignPremisesAgentResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.AssignPremisesAgentReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * （15）	楼盘指定分销商
 * 
 * @author jzliu
 *		
 */
@Service("assignPremisesAgentHander")
public class AssignPremisesAgentHander extends CommonAbstractHander {
	private static Logger logger= LoggerFactory.getLogger(AssignPremisesAgentHander.class);
	
	@Autowired
	private PremisesApiService premisesService;
	@Autowired
	private WxAccessTokenCacheUtils wxAccessTokenCacheUtils;
	
	@SuppressWarnings("rawtypes")
	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		AssignPremisesAgentReqVo req = (AssignPremisesAgentReqVo)reqDto;
		AssignPremisesAgentReqDto reqDto1 = req.getParams();
		BaseResponseDTO<AssignPremisesAgentResDto> res = new BaseResponseDTO<AssignPremisesAgentResDto>();
		AssignPremisesAgentResDto resDto = new AssignPremisesAgentResDto();
		try {
			resDto = premisesService.assignPremisesAgent(reqDto1);
		} catch (Exception e) {
			logger.error("AssignPremisesAgentHander error: {}", e);
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg("楼盘审核失败!");
		}
		res.setResData(resDto);
		res.setResult(resDto.getResult());
		return res;
	}
	
}
